<div class="important">
    <img src="../public/all/images/important.png" width="18px"/>
    为了您的资金安全，请使用真实资料！
</div>

<div class="common_item">
    <table class="with-title-input">
        <tr>
            <td class="title">代 理</td>
            <td class="input">
                <input type="text" class="am-form-field daili" placeholder="请输入推荐人或上级代理的账号名" />
            </td>
        </tr>
    </table>
</div>
<div class="common_clue">推荐人或上级代理账号，如没有可不填写。</div>

<div class="common_item">
    <table class="with-title-input">
        <tr>
            <td class="title">账 号</td>
            <td class="input">
                <input type="text" class="am-form-field account" placeholder="请输入您的账户名" />
            </td>
        </tr>
    </table>
</div>
<div class="form_clue">*请使用6-15位英文或数字的组合</div>

<div class="common_item">
    <table class="with-title-input">
        <tr>
            <td class="title">密 码</td>
            <td class="input">
                <input type="password" class="am-form-field p1" placeholder="请输入登录密码" />
            </td>
            <td class="see">
                <img src="../public/all/images/phone/see.png"/>
            </td>
        </tr>
    </table>
</div>
<div class="form_clue">*请使用6-15位英文或数字的组合</div>

<div class="common_item">
    <table class="with-title-input">
        <tr>
            <td class="title">重复密码</td>
            <td class="input">
                <input type="password" class="am-form-field p2" placeholder="请输入登录密码" />
            </td>
            <td class="see">
                <img src="../public/all/images/phone/see.png"/>
            </td>
        </tr>
    </table>
</div>
<div class="form_clue">*请再次确认登录密码</div>

<div class="common_item">
    <table class="with-title-input">
        <tr>
            <td class="title">真实姓名</td>
            <td class="input">
                <input type="text" class="am-form-field" id="realname" placeholder="请输入您的真实姓名" />
            </td>
        </tr>
    </table>
</div>
<div class="form_clue">请填写银行卡上的账户名称，填写后不可更改。</div>

<div style="margin: 10px 15px 5px 15px;">
    <button type="button" class="am-btn am-btn-primary common_button btn-register">注册</button>
</div>

<div class="bottom_clue">
    已有账号？<a href="center.html?cmd=login">马上登录</a>
</div>

<style type="text/css">
    .bottom_clue {
        text-align: center;
    }
    .bottom_clue a {
        color: #2cc0ce;
    }
</style>

<script src="js/login.js"></script>
<script>
    ME.autoExit = false;
    me.prototype.loop = function() {}

    if (urlInfo.params.referee) {
        $("input.daili").val(urlInfo.params.referee);
    }

    $(".btn-register").click(function() {
        var account = $(".account").val().trim();
        if (account == '') {
            alert2("请输入账号！");
            return;
        }
        if (!(/^[0-9a-zA-Z_]{5,14}$/.test(account))) {
            alert2("账号名不合法！", true);
            return;
        }

        var p1 = $(".p1").val().trim(), p2 = $(".p2").val().trim();
        if (p1 == '') {
            alert2("请输入登录密码！");
            return;
        }
        if (p2 == '') {
            alert2("请再次输入登录密码！");
            return;
        }
        if (p1 != p2) {
            alert2("两次密码输入不一致！");
            return;
        }
        if (!(/^[0-9a-zA-Z_]{5,14}$/.test(p1))) {
            alert2("密码不合法！", true);
            return;
        }

        Login.register(account, p1, function() {
            var realname = $(".realname").val().trim();
            if (realname != '') {
                // 设置真实姓名
                CMD.modify_user_info(null, {
                    name: realname,
                });
            }
        });
    });
</script>